<?php
/**
 * Created by program.
 * Description:地区管理
 * User: sunnier
 * Email: xiaoyao_xiao@126.com
 * Date: 2020-11-18
 * Time: 15:39
 */
namespace app\api\controller;

class Area extends Base
{
    protected $areaService;

    public function initialize()
    {
        parent::initialize();

        $this->areaService=app('app\common\service\AreaService');
    }

    /**
     * @return \think\response\Json
     * Description:获取省列表
     * Author:sunnier
     * Email:xiaoyao_xiao@126.com
     * 2020-11-18 15:51
     */
    public function province(){
        $result=$this->areaService->getProvince();
        return api_res($result['status'],$result['msg'],$result['data']);
    }

    /**
     * @return \think\response\Json
     * Description:根据省获取市
     * Author:sunnier
     * Email:xiaoyao_xiao@126.com
     * 2020-11-18 15:51
     */
    public function city(){
        $postData=input('get.');
        $result=$this->areaService->getCityByProvince(['pid'=>$postData['id']]);
        return api_res($result['status'],$result['msg'],$result['data']);
    }
}